/** * @license * Copyright 2020s JBoss Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { ChangeDetectorRef, EventEmitter } from "@angular/core"; import { Node, NodePath, AaiChannelItem, Aai20Document, Aai20SchemaDefinition, AaiMessageTraitDefinition, AaiOperationTraitDefinition, AaiMessage } from "apicurio-data-models"; import { AddChannelDialogComponent } from "./dialogs/add-channel.component"; import { CloneDefinitionDialogComponent } from "./dialogs/clone-definition.component"; import { SelectionService } from "../_services/selection.service"; import { CommandService } from "../_services/command.service"; import { EditorsService } from "../_services/editors.service"; import { DataTypeData } from "./editors/data-type-editor.component"; import { RestResourceService } from "../_services/rest-resource.service"; import { AbstractBaseComponent } from "./common/base-component"; import { DocumentService } from "../_services/document.service"; import { RenameEntityDialogComponent, RenameEntityEvent } from "./dialogs/rename-entity.component"; import { FeaturesService } from "../_services/features.service"; import { ComponentType } from "../_models/component-type.model"; import { OperationTraitData } from "./editors/operationtrait-editor.component"; import { MessageTraitData } from "./editors/messagetrait-editor.component"; import { CloneChannelDialogComponent } from "./dialogs/clone-channel.component"; import { ConfigService } from "../../../../../services/config.service"; import { MessageData } from "./editors/message-editor.component"; /** * The component that models the master view of the API editor. This is the * left-hand side of the editor, which lists things like Paths and Definitions. * Users will select an item in this master panel which will result in a form * being displayed in the detail panel. */ export declare class AsyncApiEditorMasterComponent extends AbstractBaseComponent { private commandService; private editors; private restResourceService; private features; channelNameRegex: string; document: Aai20Document; onImportComponent: EventEmitter; contextMenuSelection: NodePath; contextMenuType: string; contextMenuPos: any; addChannelDialog: AddChannelDialogComponent; cloneChannelDialog: CloneChannelDialogComponent; renameChannelDialog: RenameEntityDialogComponent; cloneDefinitionDialog: CloneDefinitionDialogComponent; renameDefinitionDialog: RenameEntityDialogComponent; renameOperationTraitDialog: RenameEntityDialogComponent; renameMessageTraitDialog: RenameEntityDialogComponent; renameMessageDialog: RenameEntityDialogComponent; filterCriteria: string; _channels: AaiChannelItem[]; _defs: Aai20SchemaDefinition[]; _opTraitsDefs: AaiOperationTraitDefinition[]; _msgTraitsDefs: AaiMessageTraitDefinition[]; _msgsDefs: AaiMessage[]; /** * C'tor. * @param changeDetectorRef * @param documentService * @param selectionService * @param configService * @param commandService * @param editors * @param restResourceService * @param features */ constructor(changeDetectorRef: ChangeDetectorRef, documentService: DocumentService, selectionService: SelectionService, configService: ConfigService, commandService: CommandService, editors: EditorsService, restResourceService: RestResourceService, features: FeaturesService); ngOnInit(): void; protected onDocumentChange(): void; onChannelsKeypress(event: KeyboardEvent): void; onDefinitionsKeypress(event: KeyboardEvent): void; protected handleArrowKeypress(event: KeyboardEvent, items: Node[]): void; /** * Called when the user searches in the master area. * @param criteria */ filterAll(criteria: string): void; /** * Returns an array of paths that match the filter criteria and are sorted alphabetically. */ channels(): AaiChannelItem[]; /** * Returns true if the channels have been initialized to non empty */ hasChannels(): boolean; /** * Returns the array of definitions, filtered by search criteria and sorted. */ definitions(): Aai20SchemaDefinition[]; /** * Returns true if the definitions have been initialized to non empty */ hasDefinitions(): boolean; /** * Returns the array of operation trait definitions, filtered by search criteria and sorted. */ operationTraits(): AaiOperationTraitDefinition[]; /** * Returns true if the operationTraits have been initialized to non empty */ hasOperationTraits(): boolean; /** * Returns the array of message trait definitions, filtered by search criteria and sorted. */ messageTraits(): AaiMessageTraitDefinition[]; /** * Returns the array of message definitions, filtered by search criteria and sorted. */ messages(): AaiMessage[]; /** * Returns true if the messageTraits have been initialized to non empty */ hasMessageTraits(): boolean; /** * Returns true if the messages have been initialized to non empty */ hasMessages(): boolean; /** * Gets a definition by its name. * @param name */ protected getDefinitionByName(name: string): Aai20SchemaDefinition; definitionsPath(): string; /** * Called whenever the user presses a key. * @param event */ onGlobalKeyDown(event: KeyboardEvent): void; /** * Called to return the currently selected path (if one is selected). If not, returns "/". */ getCurrentChannelSelection(): string; /** * Called when the user fills out the Add Channel modal dialog and clicks Add. * @param channel */ addChannel(channel: string): void; /** * Called when the user clicks "Rename Channel" in the context-menu for a channel. */ renameChannel(modalData?: any): void; /** * Called when the user clicks "Clone Channel" in the context-menu for a channel. */ cloneChannel(modalData?: any): void; /** * Called when the user clicks "Delete Channel" in the context-menu for a channel. */ deleteChannel(): void; /** * Returns true if the given item is a valid channel in the current document. * @param channelItem */ protected isValidChannelItem(channelItem: AaiChannelItem): boolean; /** * Called when the user fills out the Add Definition modal dialog and clicks Add. */ addDefinition(data: DataTypeData): void; /** * Called when the user clicks "Clone Definition" in the context-menu for a definition. */ cloneDefinition(modalData?: any): void; /** * Called when the user clicks "Rename Definition" in the context-menu for a schema definition. */ renameDefinition(event?: RenameEntityEvent): void; /** * Called when the user clicks "Delete Definition" in the context-menu for a schema definition. */ deleteDefinition(): void; /** * Called when the user fills out the Add Operation Trait page and clicks Add. */ addOperationTrait(trait: OperationTraitData): void; /** * Called when the user clicks "Rename OperationTrait" in the context-menu for a OperationTrait. */ renameOperationTrait(event?: RenameEntityEvent): void; /** * Called when the user clicks "Delete Operation Trait" in the context-menu for a trait. */ deleteOperationTrait(): void; /** * Called when the user fills out the Add Message Trait page and clicks Add. */ addMessageTrait(trait: MessageTraitData): void; /** * Called when the user clicks "Rename MessageTrait" in the context-menu for a MessageTrait. */ renameMessageTrait(event?: RenameEntityEvent): void; /** * Called when the user clicks "Delete Message Trait" in the context-menu for a trait. */ deleteMessageTrait(): void; /** * Called when the user fills out the Add Message page and clicks Add. */ addMessage(mes: MessageData): void; /** * Called when the user clicks "Rename Message" in the context-menu for a Message. */ renameMessage(event?: RenameEntityEvent): void; /** * Called when the user clicks "Delete Message" in the context-menu for a trait. */ deleteMessage(): void; /** * Converts a JSON formatted string example to an object. * @param from */ protected exampleAsObject(from: string): any; /** * Figures out the definition name. * @param schemaDef */ protected definitionName(schemaDef: Aai20SchemaDefinition): string; /** * Returns true if the given schema definition is valid and contained within the * current document. * @param definition * @return */ protected isValidDefinition(definition: Aai20SchemaDefinition): boolean; /** * Called when the user selects the main/default element from the master area. */ selectMain(): void; /** * Called when the user selects a channel from the master area. * @param channel */ selectChannel(channel: AaiChannelItem): void; /** * Called to deselect the currently selected channel. */ deselectChannel(): void; /** * Called when the user selects a definition from the master area. * @param def */ selectDefinition(def: Aai20SchemaDefinition): void; /** * Deselects the currently selected definition. */ deselectDefinition(): void; /** * Called when the user selects an operation trait definition from the master area. * @param operationTraitDef */ selectOperationTrait(operationTraitDef: AaiOperationTraitDefinition): void; /** * Deselects the currently selected operation trait definition. */ deselectOperationTrait(): void; /** * Called when the user selects a message trait definition from the master area. * @param messageTraitDef */ selectMessageTrait(messageTraitDef: AaiMessageTraitDefinition): void; /** * Called when the user selects a message definition from the master area. * @param messageDef */ selectMessage(messageDef: AaiMessage): void; /** * Deselects the currently selected message trait definition. */ deselectMessageTrait(): void; /** * Deselects the currently selected message definition. */ deselectMessage(): void; /** * Returns true if the given node is the currently selected item *or* is the parent * of the currently selected item. * @param node * @return */ isSelected(node: Node): boolean; /** * Returns true if the main node should be selected. * @return */ isMainSelected(): boolean; /** * Returns true if the given node is the current context menu item. * @param node * @return */ isContexted(node: Node): boolean; /** * Called when the user right-clicks on a path. * @param event * @param pathItem */ showChannelContextMenu(event: MouseEvent, channelItem: AaiChannelItem): void; /** * Called when the user right-clicks on a data type. * @param event * @param definition */ showDefinitionContextMenu(event: MouseEvent, definition: Aai20SchemaDefinition): void; /** * Called when the user right-clicks on an operation trait definition. * @param event * @param opTraitDef */ showOperationTraitContextMenu(event: MouseEvent, opTraitDef: AaiOperationTraitDefinition): void; /** * Called when the user right-clicks on a message trait definition. * @param event * @param msgTraitDef */ showMessageTraitContextMenu(event: MouseEvent, msgTraitDef: AaiMessageTraitDefinition): void; /** * Called when the user right-clicks on a message definition. * @param event * @param msgDef */ showMessageContextMenu(event: MouseEvent, msg: AaiMessage): void; /** * Called when the user clicks somewhere in the document. Used to close the context * menu if it is open. */ onDocumentClick(event: MouseEvent): void; /** * Closes the context menu. */ private closeContextMenu; /** * Called to determine whether there is a validation problem associated with the given * node (either directly on the node or any descendant node). * @param node */ hasValidationProblem(node: Node): boolean; entityClasses(node: Node): string; /** * Returns the classes that should be applied to the channel item in the master view. * @param node * @return */ channelClasses(node: AaiChannelItem): string; /** * Returns the classes that should be applied to the schema definition in the master view. * @param node * @return */ definitionClasses(node: Node): string; /** * Returns the classes that should be applied to the operation trait definition in the master view. * @param node * @return */ operationTraitClasses(node: Node): string; /** * Returns the classes that should be applied to the message trait definition in the master view. * @param node * @return */ messageTraitClasses(node: Node): string; /** * Returns the classes that should be applied to the message definition in the master view. * @param node * @return */ messageClasses(node: Node): string; /** * Opens the Add Definition Editor (full screen editor for adding a data type). */ openAddDefinitionEditor(): void; /** * Opens the Add Operator Trait Editor (full screen editor for adding a data type). */ openAddOperationTraitEditor(): void; /** * Opens the Add Message Trait Editor (full screen editor for adding a data type). */ openAddMessageTraitEditor(): void; /** * Opens the Add Message Editor (full screen editor for adding a data type). */ openAddMessageEditor(): void; importsEnabled(): boolean; importDataTypes(): void; importMessageTraits(): void; importMessages(): void; }